package cn.com.lms.business.log.enums;

/**
 * 题型 1-查询 2-新增 修改 删除 5.登录 6.退出
 */
public enum ActionTypeEnum {
    SELECT("查询", Short.valueOf("1")),
    ADD("新增", Short.valueOf("2")),
    EDIT("修改", Short.valueOf("3")),
    DELETE("删除", Short.valueOf("4")),
    LOGIN("登录", Short.valueOf("5")),
    LOGIN_OUT("退出", Short.valueOf("6"));
    private String name;//名称

    private Short value;//值

    /**
     * 通过type获取Msg
     *
     * @param type
     * @return
     * @Description:
     */
    public static String getEnumMsgByType(String type) {
        for (ActionTypeEnum e : ActionTypeEnum.values()) {
            if (e.toString().equals(type)) {
                return e.name;
            }
        }
        return "";
    }

    public static Short getEnumValueByType(String type) {
        for (ActionTypeEnum e : ActionTypeEnum.values()) {
            if (e.toString().equals(type)) {
                return e.value;
            }
        }
        return 0;
    }

    private ActionTypeEnum(String name, Short value) {
        this.name = name;
        this.value = value;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Short getValue() {
        return value;
    }

    public void setValue(Short value) {
        this.value = value;
    }
}
